package com.huike.web.controller.system;

import com.huike.clues.domain.SysNotice;
import com.huike.clues.service.ISysNoticeService;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.core.page.TableDataInfo;
import com.mysql.cj.protocol.x.Notice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("system/notice")
public class SysNoticeController extends BaseController {
@Autowired
private ISysNoticeService sysNoticeService;
    @GetMapping("list/{status}")
    public AjaxResult<List<SysNotice>> list(@PathVariable("status") String status){
        List<SysNotice> list=sysNoticeService.list(status);
        return AjaxResult.success(list);
    }
@GetMapping("pagelist/{status}")
    public TableDataInfo<SysNotice> pageList(@PathVariable("status") String status){
    startPage();
    List<SysNotice> list = sysNoticeService.list(status);
    return getDataTable(list);
}
@GetMapping("{noticeId}")
    public AjaxResult infoNotice(@PathVariable("noticeId") Long noticeId){
        SysNotice sysNotice=sysNoticeService.info(noticeId);
        return AjaxResult.success(sysNotice);
}
@PutMapping("{noticeId}")
    public AjaxResult find(@PathVariable("noticeId") Long noticeId){
    sysNoticeService.update(noticeId);
    return AjaxResult.success();
}
}
